
<%@page import="Entities.*"%>
<%@page import="Helpers.*"%>
<%@page import="Hibernate.*"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@include file="../../views/header.jsp" %>
<%@include file="../../views/mainMenu.jsp" %>
<%@include file="../../views/userMenu.jsp" %>
<%@include file="../../views/cntColumnOpen.jsp" %>

        <%
        String id = (String) request.getParameter("id");
        String naam = (String) request.getParameter("naam");
        String omschrijving = (String) request.getParameter("omschrijving");
         String prijs = (String) request.getParameter("prijs");
        String afbeelding = (String) request.getParameter("afbeelding");
        if(naam == null){
                         
        %>

<h2>Toevoegen cursus</h2>
<p>U kunt nu uw profiel bewerken via deze pagina.</p>
<form id="form6" name="form6" class="wufoo leftLabel" method="post" action="webpages/Cursus/addCursus.jsp">

    <ul>
        <li id="fo6li8" class="section">
            <h3 id="title8">Persoonlijke informatie</h3>
            <div id="instruct8">A description of the section goes here.</div>
        </li>

        <li id="fo6li1" class="complex">
            <label class="desc" id="title1" for="Field1">
                Cursus <span id="req_116" class="req">*</span>
            </label>
            <div>
                <span class="left">

                    <input id="naam" name="naam" type="text" class="field text addr" maxlength="20" tabindex="10" />
                    <label for="Field5">Naam</label>
                </span>
                <span class="right">




<select id="type" name="actief" class="field select addr" tabindex="14" >
<option value="true" >Ja</option>
<option value="false" >Nee</option>
</select>
<label for="Field5">Actief</label>



                </span>
            </div>
        </li>

        <li id="fo6li113"
class="    ">


<label class="desc" id="title113" for="Field113">
Omschrijving
</label>
<div>
<textarea id="Field113" name="omschrijving" class="field textarea large" rows="25" cols="175" ></textarea>

</div>



</li>

        <li id="fo6li1">
            <label class="desc" id="title1" for="Field1">
                Afbeelding <span id="req_116" class="req">*</span>
            </label>
            <div>
                <span>
                    <input id="afbeelding" name="afbeelding" type="text" class="field text addr" tabindex="10" />
                </span>
            </div>
        </li>

                <li id="fo6li1">
            <label class="desc" id="title1" for="Field1">
               Prijs <span id="req_116" class="req">*</span>
            </label>
            <div>
                <span>
                    <input id="afbeelding" name="prijs" type="text" class="field text addr" tabindex="10" />
                </span>
            </div>
        </li>

    </ul><br />
<input type="hidden" name="id">
     <input name="submit" type="submit" class="btn" tabindex="16" value="Toevoegen cursus" />&nbsp;&nbsp;<a href="webpages/Cursus/showCursussen.jsp">(annuleer)</a>

     </form>


        <%
        } else{
               CursusHelper cHelper = new CursusHelper();
               Cursussen cursus = new Cursussen();

               cursus.setNaam(naam);
               cursus.setOmschrijving(omschrijving);
               cursus.setAfbeelding_url(afbeelding);
               cursus.setPrijs(prijs);
               cursus.setActief(Boolean.parseBoolean(request.getParameter("actief").toLowerCase()));
               cHelper.persistCursus(cursus);

               response.sendRedirect("showCursussen.jsp");
           }
        %>

<%@include file="../../views/cntColumnRight.jsp" %>
<%@include file="../../views/footer.jsp" %>